package com.binguo.model.mapper;

import com.binguo.model.model.*;

import java.util.List;


import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;


public interface SideBoardCellsMapper {
    int countByExample(SideBoardCellsExample example);

    int deleteByExample(SideBoardCellsExample example);

    int deleteByPrimaryKey(Integer id);

    int insert(SideBoardCells record);

    int insertSelective(SideBoardCells record);

    List<SideBoardCells> selectByExample(SideBoardCellsExample example);

    SideBoardCells selectByPrimaryKey(Integer id);

    int updateByExampleSelective(@Param("record") SideBoardCells record, @Param("example") SideBoardCellsExample example);

    int updateByExample(@Param("record") SideBoardCells record, @Param("example") SideBoardCellsExample example);

    int updateByPrimaryKeySelective(SideBoardCells record);

    int updateByPrimaryKey(SideBoardCells record);


    List<SideBoardCells> selectAllSideBoardCell(@Param("id") Integer id);

    Integer insertByList(@Param("list") List<SideBoardCells> list);

    SideBoardCells selectByCellAndMealCodeAndOrderNo(@Param("cell")Integer cell,@Param("mealCode")String mealCode,
                                                     @Param("orderId")String orderId);

    Integer selectShopBranchId(@Param("orderId")String orderId);

    List<Integer> selectSideboardIdByOrderId(@Param("orderId")String orderId);

    @Select("select id as id,cell as cell,status as status,side_board_id as sideBoardId ,meal_code as mealCode,is_warm as isWarm from side_board_cells where order_id = #{orderId}")
    List<SideBoardCells> selectByOrderId(@Param("orderId")String orderId);

    Integer updateSideBoardCellsByList(@Param("details")List<SideBoardCells> sideBoardCells);

    @Select("select side_board_cells.`status` from side_board_cells INNER JOIN side_board on side_board.id = side_board_cells.side_board_id where side_board.cashier_desk_id = #{cashierDeskId} and side_board_cells.cell = #{cell}")
    Integer selectStatusByCellNoAndCashierDeskId(@Param("cashierDeskId") Integer cashierDeskId,@Param("cell")String cell);

    Integer updateSideBoardCells(@Param("sideBoardCells")SideBoardCells sideBoardCells);

    List<SideBoardCells> getSideBoardCellsListBySideBoardCellDetails(@Param("list")List<SideBoardCellDetail> sideBoardCellDetails);


    List<SideBoardCells> selectByOrderIds(@Param("orderIds")List<String> orderIds);
    @Select("select id as id,cell as cell,status as status,side_board_id as sideBoardId,order_id as orderId,meal_code as mealCode,is_warm as isWarm from side_board_cells where cell = #{cell} and  side_board_id = #{sideBoardId}")
    SideBoardCells selectBySideBoardAndCell(@Param("sideBoardId")Integer sideBoardId,@Param("cell")String cell);



}